<template>
	<view class="content">
		<view class="data-list" v-if="paidList.length > 0">
			<view class="item" v-for="(item, index) in paidList">
				<view class="stage">
					<!-- <text v-if="item.is_first == 1">首期支付 {{item.stage}}/{{item.count}}期</text> -->
					<text>{{item.stage}}/{{item.count}}期</text>
					<text class="num">¥{{item.stage_price}}</text>
				</view>
				<view class="info">
					<view class="time">{{item.pay_time}}，<text class="green">已还</text></view>
					<view class="price">含租金¥{{item.stage_price}}<text v-if="item.is_overdue">+违约金¥{{item.overdue_price}}</text></view>
				</view>
			</view>
			
			<view class="loading-end">
				别滑啦，已经到底了～
			</view>
		</view>
		<view v-else>
			<view class="no-data">
				暂无已还账单
			</view>
		</view>
	</view>
	
</template>

<script>
	import {
		getStageBillList
	} from '@/api/order.js';
	export default {
		data() {
			return {
				order_id: '',
				paidList: []
			}
		},
		onLoad(options) {
			const that = this
			this.$set(this, 'order_id', options.order_id);
			getStageBillList(this.order_id).then(res => {
				that.$set(that, 'paidList', res.data.paid_list);
				that.opts.title.name = res.data.rent_price;
			})
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}
	.no-data {
		width: 100%;
		height: 400rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		color: #999999;
	}
	
	.loading-end {
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		color: #999999;
	}
	
	.data-list {
		.item {
			padding:  24rpx;
			
			&~.item {
				border-top: 2rpx solid #F5F5F5;
			}
			
			.content {
				display: flex;
				flex-direction: row;
				align-items: center;
				height: 144rpx;
				
				.left {
					height: 144rpx;
					width: 72rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					margin-right: 10rpx;
				}
				
				.middle {
					flex: 1;
					
					.count {
						font-size: 28rpx;
						font-weight: bold;
						color: #1F1F1F;
					}
					
					.time {
						margin-top: 20rpx;
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;
						line-height: 24rpx;
						
						.red {
							color: #FF271F;
						}
						
						.green {
							color: #16B86C;
						}
					}
				}
				
				.right {
					.num {
						font-size: 36rpx;
					}
				}
			}
			
			.stage {
				display: flex;
				justify-content: space-between;
				align-items: center;
				
				
				text {
					font-size: 28rpx;
					font-weight: bold;
					color: #1F1F1F;
				}
				
				.num {
					font-size: 36rpx;
				}
			}
		
			.info {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 24rpx;
				
				.time {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					line-height: 24rpx;
					
					.red {
						color: #FF271F;
					}
					
					.green {
						color: #16B86C;
					}
				}
				
				.price {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
				}
			}
		}
	}
</style>